﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Default" %>


<%@ Register Src="~/UserCtrl-PhieuChi/Header.ascx" TagName="Header" TagPrefix="gc_header" %>
<%@ Register Src="~/UserCtrl-PhieuChi/Footer.ascx" TagName="Footer" TagPrefix="gc_footer" %>

<%@ Register Src="~/UserCtrl-PhieuChi/PagerTop.ascx" TagName="PagerTop" TagPrefix="gc_pagertop" %>

<%@ Register Src="~/UserCtrl-PhieuChi/MainMenuQLNS.ascx" TagName="MainMenu" TagPrefix="gc_MainMenu" %>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Anh Xuan - Technology</title>

    <!-- Le styles -->
    <link href="../UserControl/bootstrap/assets/css/bootstrap.css" rel="stylesheet" />
    <link href="../UserControl/bootstrap/assets/css/bootstrap-responsive.css" rel="stylesheet" />
    <link href="../UserControl/bootstrap/assets/css/docs.css" rel="stylesheet" />
    <link href="../UserControl/bootstrap/assets/js/google-code-prettify/prettify.css" rel="stylesheet" />

    <link rel="stylesheet" type="text/css" href="../UserControl/style_home.css" />

    <link rel="stylesheet" href="../UserControl/colorbox-master/css/colorbox.css" />

    <link rel="stylesheet" type="text/css" href="../UserControl/styles-12.css" />
    <link rel="stylesheet" href="../UserControl/datepicker/css/datepicker.css" />
    <link rel="stylesheet" href="../UserControl/jPager/css/custom-pager.css" />
    <link rel="stylesheet" href="../UserControl/jPager/css/jPaginator.css" />
    <link href="../UserControl/bootstrap/assets/css/bootstrap-select.css" rel="stylesheet" />
    <!-- jTable style file -->
    <link href="../jsGobalLib/Scripts/jtable/themes/lightcolor/green/jtable.min.css" rel="stylesheet" type="text/css" />

    <link rel="stylesheet" type="text/css" href="../JSGobalLib/jquery-ui-themes-1.10.3/themes/ui-lightness/jquery-ui.css" />
    <link rel="stylesheet" type="text/css" href="../JSGobalLib/jquery-ui-themes-1.10.3/themes/ui-lightness/jquery.ui.theme.css" />
    <link href="../UserControl/bootstrap/assets/css/bootstrap-multiselect.css" rel="stylesheet" />
    <style type="text/css">
        .rptTable {
            margin-top: 20px;
            margin-bottom: 20px;
        }

        .login_sign select {
            float: left;
            margin-top: 5px;
            margin-bottom: 5px;
        }

        #assign-work .row {
            margin-top: 4px;
            margin-bottom: 4px;
        }
    </style>


    <script type="text/javascript" src="../jsGobalLib/xdate.js"></script>
    <script type="text/javascript" src="../jsGobalLib/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="../jsGobalLib/jquery-migrate-1.2.1.js"></script>

    <script type="text/javascript" src="../jsGobalLib/jquery-ui-1.10.3/ui/jquery-ui.js"></script>
    <script type="text/javascript" src="../jsGobalLib/jquery.validate.js"></script>

    <script type="text/javascript" src="../UserControl/colorbox-master/jquery.colorbox.js"></script>
    <script type="text/javascript" src="../UserControl/datepicker/js/bootstrap-datepicker.js"></script>
    <script type="text/javascript" src="../UserControl/jPager/js/jPaginator-min.js"></script>
    <script type="text/javascript" src="../jsGobalLib/PageInitSize.js"></script>

    <script src='../Common/gc_ShowDivData.js' type='text/javascript'></script>
    <script type="text/javascript" src="../common/gcGlobalForm.js"></script>
    <script type="text/javascript" src="../common/gcGlobal.js"></script>
    <script type="text/javascript" src="../common/Kernel.js"></script>
    <script type="text/javascript" src="../js/o.js"></script>
    <script src="../UserControl/bootstrap/assets/js/bootstrap-select.js"></script>
    <script src="../UserControl/bootstrap/assets/js/bootstap-multiselect.js"></script>

    <!-- Report js -->
    <script src="../Common/report.js"></script>



    <script src="../jsGobalLib/Scripts/jtablesite.js" type="text/javascript"></script>
    <!-- A helper library for JSON serialization -->
    <script type="text/javascript" src="../jsGobalLib/Scripts/jtable/external/json2.js"></script>
    <!-- Core jTable script file -->
    <script type="text/javascript" src="../jsGobalLib/Scripts/jtable/jquery.jtable.js"></script>
    <!-- ASP.NET Web Forms extension for jTable -->
    <script type="text/javascript" src="../jsGobalLib/Scripts/jtable/extensions/jquery.jtable.aspnetpagemethods.js"></script>
    <script src="../Common/report.js"></script>
    <script type="text/javascript">
        //---------------------------------------------
        var assignWorkHtml = '';
        function fun_BreakControlEnter(id) {
            //if (id == 'VatTuIdP72')
            //    return false;
            return false;
        }
        function pAsg(cur_gb_Obj, cur_gb_CotrolID) {

        }
        //---------------------------------------------

        function FocusCmbText(strId, e) {
            cur_gb_CotrolID = strId;
            if (cur_gb_CotrolID)
                gc_GetListData(strId, e);
        }
        function gc_GetListData(strId, ev) {
            var ev = ev || window.event;
            var keyCode = (ev == null) ? -1 : (ev.keyCode || ev.which);
            /* tab null backspace , minus*/
            if (keyCode == 9 || keyCode == 16 || keyCode == 17) {
                $("#divShowID").hide();
                return;
            }
            else if (keyCode == 40) {
                gc_fn_Gobal_ProcessArrowDown(strId, ev);
                ev.preventDefault();
                return;
            }
            else if (keyCode == 38) {
                gc_fn_Gobal_ProcessArrowUp(strId, ev);
                ev.preventDefault();
                return;
            }
            else if (keyCode == 13) {
                var ctrlTmp = $get('itemid' + cur_gb_Index.toString());
                if (ctrlTmp != null)
                    ctrlTmp.onclick();

                return;
            }
            cur_gb_Obj = gcGobal_INCOM_Receipt.create();
            cur_gb_Obj.Id = "-9999";
            cur_gb_CotrolID = strId;

            /*check have space at the end*/
            var value = $get(cur_gb_CotrolID).value;
            //        if (value.indexOf('101'))
            //            value += ' ';
            if (value.length > 0 && value[value.length - 1] != ' ')
                return true;
            /*end check*/
            cur_gb_FlagControlCmb = 0;
            gb_strFilter = ' '; /*reset filter*/
            if (cur_gb_CotrolID) {
                cur_gb_Index = -1;


                $("#" + cur_gb_CotrolID).removeClass("gc-style-form-combo");
                $("#" + cur_gb_CotrolID).addClass("loader");
                //không cần truyền user vì dư thừa chúng ta có thể check dc bằng server.
                if (cur_gb_CotrolID == 'cmb_CourseID') /* check ID for get object*/
                    WSgcGobal_TRAINNING_COURSE_CLASS.getCourseIdName(value, gb_NumComboBox, gb_strFilter, cur_gb_Obj, cur_gb_Account, showPopupDivData, gc_gb_fn_LoadComboFail);
                else if (cur_gb_CotrolID == 'gcReportTypeID') {
                    cur_gb_FlagControlCmb = 1;
                    updateDivReport(StrStatusKH);
                }
            }
        }
        function test(strId, ev, s, tt, cc) {
            cur_gb_CotrolID = strId;
            var value = $get(cur_gb_CotrolID).value;
            if ($('#' + strId).val() == '')
                $('#' + strId.substr(0, strId.length - 1) + 'h').val('');
            cur_gb_FlagControlCmb = 0;
            gb_strFilter = ' '; /*reset filter*/
            if (cur_gb_CotrolID && (ev.type == 'click' || (ev.keyCode == 8 && $('#' + strId).val() == ''))) {
                var cl = cc.ra('~', ',');
                cl = 'Id,' + cl;
                cur_gb_Obj = new Object();
                cur_gb_Index = -1;
                cur_gb_Obj.Id = '-9999';
                cur_gb_Obj.v = value;
                cur_gb_Obj.n = gb_NumComboBox;
                cur_gb_Obj.f = gb_strFilter;
                cur_gb_Obj.fid = cur_gb_CotrolID;
                //cur_gb_Obj.oid = s.__id;
                cur_gb_Obj.a = 'pGet' + tt;
                cur_gb_Obj.c = '';
                cur_gb_Obj.d = '';
                cur_gb_Obj.type = 'p';
                cur_gb_Obj.cl = cl;
                cur_gb_Obj.si = 1;
                cur_gb_Obj.mr = 25;
                //  obj: { a: 'pGet' + s._e[0], c: '', d: '', type: 'p', cl: '*', si: 1, mr: 25, se: ' Id desc', f: gb_strFilterGrid }
                $('#' + cur_gb_CotrolID).removeClass('gc-style-form-combo');
                $('#' + cur_gb_CotrolID).addClass('loader');
                //không cần truyền user vì dư thừa chúng ta có thể check dc bằng server.
                Kernel.P(cur_gb_Obj, shd);
            }
        }

        var o278 = {//gcGobal_TASK_Assignment 
            _v: ['gcGobal_TASK_Assignment', 'Id', 'Nhân viên ', 'Công việc', 'Tình trạng ', 'Mức độ ', 'Sự kiện ', 'Ngoại lệ ', 'Mô tả kết quả ', 'Ghi chú ', 'Ngày bắt đầu', 'Ngày kết thúc', 'Nhắc nhở', 'Số lần nhắc nhở', 'Nhắc trước ', 'Thời gian nhắc', 'Điểm ', 'Điểm trừ ', 'Điểm cộng ', 'isPrgStatus', 'isPrgAccountId', 'isPrgAccountUId', 'isPrgCreatedDate', 'isPrgUpdatedDate', 'username/userid/departmentid/agentid/compid', 'Vietnamese for name or orther', 'userid/agentid/departmentid/compid/action/data', ],
            _e: ['gcGobal_TASK_Assignment', 'Id', 'EmployeeId', 'WorkId', 'TaskStatusId', 'WorkLevelId', 'WorkEventId', 'WorkExternalId', 'DescriptResult', 'Note', 'StartDate', 'EndDate', 'Reminder', 'NumReminder', 'BeforeTimeReminder', 'TimeReminder', 'Marks', 'SubMarks', 'AddMarks', 'isPrgStatus', 'isPrgAccountId', 'isPrgAccountUId', 'isPrgCreatedDate', 'isPrgUpdatedDate', 'isPrgPartComp', 'isPrgVNInfo', 'isPrgHistoryInfo', ],
            _d: ["00,00,0,1,0,,,,", "01,01,1,1,1,gcGobal_COMP_EmployeeLife,HoTen,27,|02,02,1,1,1,gcGobal_TASK_Works,Name,28,", "03,03,1,1,1,gcGobal_TASK_Status,Name,29,|04,04,0,1,1,gcGobal_TASK_Work_Levels,Name,30,", "05,05,1,1,1,gcGobal_TASK_Event,Name,31,|06,06,1,1,1,gcGobal_TASK_Work_External_Assignment,Name,32,", "07,07,1,4,0,,,,|08,08,1,4,0,,,,", "09,09,1,5,0,,,,|10,10,1,5,0,,,,", "11,11,0,1,0,,,,", "12,12,0,1,0,,,,", "13,13,0,1,0,,,,", "14,14,0,1,0,,,,", "15,15,1,2,0,,,,|16,16,1,2,0,,,,", "17,17,1,2,0,,,,", "18,18,0,1,0,,,,", "19,19,0,1,0,,,,", "20,20,0,1,0,,,,", "21,21,0,5,0,,,,", "22,22,0,5,0,,,,", "23,23,0,4,0,,,,", "24,24,0,4,0,,,,", "25,25,0,4,0,,,,", ],
            _f: [], _r: [], _coj: {}, __id: 278, _sy: 'dlg_cl', id: 'o278', cssb: 'inputBtnBottomV2', $dw: null, dwcss: 'login_sign',
        };
        var o281 = {//gcGobal_TASK_Event 
            _v: ['gcGobal_TASK_Event', 'Id', 'Tên ', 'Mã ', 'Họ ', 'Tiêu chí', 'Loại công việc', 'Mô tả ', 'Ghi chú ', 'Ngày bắt đầu', 'Ngày kết thúc', 'Nhắc nhở', 'Số lần nhắc nhở', 'Nhắc nhở trước', 'Thời gian nhắc nhở', 'Điểm ', 'Điểm trừ ', 'Điểm cộng', 'isPrgStatus', 'isPrgAccountId', 'isPrgAccountUId', 'isPrgCreatedDate', 'isPrgUpdatedDate', 'username/userid/departmentid/agentid/compid', 'Vietnamese for name or orther', 'userid/agentid/departmentid/compid/action/data', ],
            _e: ['gcGobal_TASK_Event', 'Id', 'Name', 'Code', 'ENGName', 'CriteriaId', 'WorkTypeId', 'Description', 'Note', 'StartDate', 'EndDate', 'Reminder', 'NumReminder', 'BeforeTimeReminder', 'TimeReminder', 'Marks', 'SubMarks', 'AddMarks', 'isPrgStatus', 'isPrgAccountId', 'isPrgAccountUId', 'isPrgCreatedDate', 'isPrgUpdatedDate', 'isPrgPartComp', 'isPrgVNInfo', 'isPrgHistoryInfo', ],
            _d: ["00,00,0,1,0,,,,", "01,01,1,4,0,,,,|02,02,1,4,0,,,,", "03,03,0,4,0,,,,", "04,04,0,1,1,gcGobal_TASK_Criteria,Code,26,|05,05,1,1,1,gcGobal_TASK_Work_Types,Name,27,", "06,06,1,4,0,,,,|07,07,1,4,0,,,,", "08,08,0,5,0,,,,", "09,09,0,5,0,,,,", "10,10,0,1,0,,,,", "11,11,0,1,0,,,,", "12,12,0,1,0,,,,", "13,13,0,1,0,,,,", "14,14,0,2,0,,,,", "15,15,0,2,0,,,,", "16,16,0,2,0,,,,", "17,17,0,1,0,,,,", "18,18,0,1,0,,,,", "19,19,0,1,0,,,,", "20,20,0,5,0,,,,", "21,21,0,5,0,,,,", "22,22,0,4,0,,,,", "23,23,0,4,0,,,,", "24,24,0,4,0,,,,", ],
            _f: [], _r: [], _coj: {}, __id: 281, _sy: 'dlg_cl', id: 'o281', cssb: 'inputBtnBottomV2', $dw: null, dwcss: 'login_sign',
        };
        var o282 = {//gcGobal_TASK_Status 
            _v: ['gcGobal_TASK_Status', 'Id', 'Tên ', 'Mã ', 'Họ ', 'Mô tả ', 'Ghi chú ', 'isPrgStatus', 'isPrgAccountId', 'isPrgAccountUId', 'isPrgCreatedDate', 'isPrgUpdatedDate', 'username/userid/departmentid/agentid/compid', 'Vietnamese for name or orther', 'userid/agentid/departmentid/compid/action/data', ],
            _e: ['gcGobal_TASK_Status', 'Id', 'Name', 'Code', 'ENGName', 'Description', 'Note', 'isPrgStatus', 'isPrgAccountId', 'isPrgAccountUId', 'isPrgCreatedDate', 'isPrgUpdatedDate', 'isPrgPartComp', 'isPrgVNInfo', 'isPrgHistoryInfo', ],
            _d: ["00,00,0,1,0,,,,", "01,01,1,4,0,,,,|02,02,1,4,0,,,,", "03,03,0,4,0,,,,", "04,04,1,4,0,,,,|05,05,1,4,0,,,,", "06,06,0,1,0,,,,", "07,07,0,1,0,,,,", "08,08,0,1,0,,,,", "09,09,0,5,0,,,,", "10,10,0,5,0,,,,", "11,11,0,4,0,,,,", "12,12,0,4,0,,,,", "13,13,0,4,0,,,,", ],
            _f: [], _r: [], _coj: {}, __id: 282, _sy: 'dlg_cl', id: 'o282', cssb: 'inputBtnBottomV2', $dw: null, dwcss: 'login_sign',
        };
        var o283 = {//gcGobal_TASK_Work_External_Assignment 
            _v: ['gcGobal_TASK_Work_External_Assignment', 'Id', 'Tên ', 'Mã ', 'Tiêu chí ', 'Loại công việc ', 'Mô tả ', 'Ghi chú ', 'Ngày bắt đầu', 'Ngày kết thúc', 'Nhắc nhở ', 'Số lần nhắc ', 'Nhắc nhở trước ', 'Thời gian nhắc ', 'Điểm ', 'Điểm trừ  ', 'Điểm cộng  ', 'isPrgStatus', 'isPrgAccountId', 'isPrgAccountUId', 'isPrgCreatedDate', 'isPrgUpdatedDate', 'username/userid/departmentid/agentid/compid', 'Vietnamese for name or orther', 'userid/agentid/departmentid/compid/action/data', ],
            _e: ['gcGobal_TASK_Work_External_Assignment', 'Id', 'Name', 'Code', 'CriteriaId', 'WorkTypeId', 'Description', 'Note', 'StartDate', 'EndDate', 'Reminder', 'NumReminder', 'BeforeTimeReminder', 'TimeReminder', 'Marks', 'SubMarks', 'AddMarks', 'isPrgStatus', 'isPrgAccountId', 'isPrgAccountUId', 'isPrgCreatedDate', 'isPrgUpdatedDate', 'isPrgPartComp', 'isPrgVNInfo', 'isPrgHistoryInfo', ],
            _d: ["00,00,0,1,0,,,,", "01,01,1,4,0,,,,|02,02,1,4,0,,,,", "03,03,0,1,1,gcGobal_TASK_Criteria,Code,25,|04,04,1,1,1,gcGobal_TASK_Work_Types,Name,26,", "05,05,1,4,0,,,,|06,06,1,4,0,,,,", "07,07,0,5,0,,,,", "08,08,0,5,0,,,,", "09,09,0,1,0,,,,", "10,10,0,1,0,,,,", "11,11,0,1,0,,,,", "12,12,0,1,0,,,,", "13,13,0,2,0,,,,", "14,14,0,2,0,,,,", "15,15,0,2,0,,,,", "16,16,0,1,0,,,,", "17,17,0,1,0,,,,", "18,18,0,1,0,,,,", "19,19,0,5,0,,,,", "20,20,0,5,0,,,,", "21,21,0,4,0,,,,", "22,22,0,4,0,,,,", "23,23,0,4,0,,,,", ],
            _f: [], _r: [], _coj: {}, __id: 283, _sy: 'dlg_cl', id: 'o283', cssb: 'inputBtnBottomV2', $dw: null, dwcss: 'login_sign',
        };
        var o287 = {//gcGobal_TASK_Works 
            _v: ['gcGobal_TASK_Works', 'Id', 'Tên công việc ', 'Mã công việc ', 'Tên tiếng anh ', 'Phòng ban ', 'Loại công việc  ', 'Lặp theo ', 'Tiêu chí ', 'Mô tả', 'Ghi chú ', 'Ngày bắt đầu', 'Ngày kết thúc', 'Nhắc nhở  ', 'Số lần nhắc ', 'Nhắc nhở trước  ', 'Thời gian nhắc  ', 'Điểm  ', 'Điểm trừ  ', 'Điểm cộng  ', 'isPrgStatus', 'isPrgAccountId', 'isPrgAccountUId', 'isPrgCreatedDate', 'isPrgUpdatedDate', 'username/userid/departmentid/agentid/compid', 'Vietnamese for name or orther', 'userid/agentid/departmentid/compid/action/data', ],
            _e: ['gcGobal_TASK_Works', 'Id', 'Name', 'Code', 'ENGName', 'DepartmentId', 'WorkTypeId', 'WorkGroupId', 'CriteriaId', 'Description', 'Note', 'StartDate', 'EndDate', 'Reminder', 'NumReminder', 'BeforeTimeReminder', 'TimeReminder', 'Marks', 'SubMarks', 'AddMarks', 'isPrgStatus', 'isPrgAccountId', 'isPrgAccountUId', 'isPrgCreatedDate', 'isPrgUpdatedDate', 'isPrgPartComp', 'isPrgVNInfo', 'isPrgHistoryInfo', ],
            _d: ["00,00,0,1,0,,,,", "01,01,1,4,0,,,,|02,02,1,4,0,,,,", "03,03,0,4,0,,,,", "04,04,1,1,1,gcGobal_COMP_Department,CODE,28,|05,05,1,1,1,gcGobal_TASK_Work_Types,Name,29,", "06,06,1,1,1,gcGobal_TASK_Work_Groups,Name,30,|07,07,1,1,1,gcGobal_TASK_Criteria,Code,31,", "08,08,1,4,0,,,,|09,09,1,4,0,,,,", "10,10,0,5,0,,,,", "11,11,0,5,0,,,,", "12,12,0,1,0,,,,", "13,13,0,1,0,,,,", "14,14,0,1,0,,,,", "15,15,0,1,0,,,,", "16,16,1,2,0,,,,|17,17,1,2,0,,,,", "18,18,1,2,0,,,,", "19,19,0,1,0,,,,", "20,20,0,1,0,,,,", "21,21,0,1,0,,,,", "22,22,0,5,0,,,,", "23,23,0,5,0,,,,", "24,24,0,4,0,,,,", "25,25,0,4,0,,,,", "26,26,0,4,0,,,,", ],
            _f: [], _r: [], _coj: {}, __id: 287, _sy: 'dlg_cl', id: 'o287', cssb: 'inputBtnBottomV2', $dw: null, dwcss: 'login_sign',
        };




        function pCb() {
            if ($('#o278').length > 0 && $('#o278_i').length > 0) {
                var $tr = $('#o278_i').find('.jtable tbody tr');
                $tr.each(function (i, el) {
                    if ($(el).find('td:nth-child(4)').text() == 'CHT') {
                        $(el).attr('style', 'background-color: #f07400 ');
                    }
                });
            }
        }

        function pCW(v, _s, ti, i, ii, ic, f0) {
            if (_s.__id == 287 && _s._e[ic + 1] == 'Name')
                v = new String(",f|0|: {" + ((ii[2] == '0') ? 'list: false,' : '') + "title: '|1|', width: '40%', display: function (data) { return (data.record.f|2| ==null)?'':data.record.f|2|+'' }  } ").f2(f0, ti, ii[1]);
            else if (_s.__id == 278 && _s._e[ic + 1] == 'DescriptResult')
                v = new String(",f|0|: {" + ((ii[2] == '0') ? 'list: false,' : '') + "title: '|1|', width: '25%', display: function (data) { return (data.record.f|2| ==null)?'':data.record.f|2|+'' }  } ").f2(f0, ti, ii[1]);
            else if (_s.__id == 278 && _s._e[ic + 1] == 'WorkId') {
                v = new String(",f|0|: {" + ((ii[2] == '0') ? 'list: false,' : '') + "title: '|1|', width: '30%', display: function (data) { return (data.record.f|2| ==null)?'':data.record.f|2|+'' }  } ").f2(f0, ti, (parseInt(ii[7]) - 1) + '');
            }
            return v;
        };

        function pCDT(o, id) {
            if (id == 278) {
                o.f09 = o.f09.substring(0, 10) + ' 00:00';
                o.f10 = o.f10.substring(0, 10) + ' 23:59';
            }
        };
        function pJtablCustomizeObj(obj, s) {
            if ($('#dropdown-database ul li.active a').attr('id') == 'a9')
                obj.se = ' taskStatusid desc ';
        }

        function view($that, $container, o, on) {
            // move html to content in right of screen and style width
            var parentWidth = $container.parent().innerWidth();
            var html = $(on).html();
            var $title = $('<h3 style="font-size: 18px; color: rgb(58, 135, 173);"/>').text($that.find('a').text());
            $container.empty().prepend($(on)).css({ "width": parentWidth + "px" });
            $(on).before($title);


            // Hide button "Dong cua so"
            var $listButton = $container.find('.inputBtnBottomV2');
            $listButton.find('.btn.btn-warning.btn-sm').hide();

            // Margin input
            var $inputFirst = $container.find('div.input').find('input:first');//.not('#fo28605i');
            $inputFirst.each(function () {
                if ($that.attr('id') == "fo28605i") {
                    $that.css({ 'margin-right': '5px' });
                }
                else {
                    $that.css({ 'margin-right': '35px' });
                }
            });

            // Add type to all input button in form
            switch ($that.find('a').attr('id')) {
                case 'a1':
                    break;
                default:
            }

        }
        function assignWork($that, $container) {
            var $box = $('<div id="assign-work" />');
            $box.append(assignWorkHtml);
            $container.empty().append($box);
            $('#list-employee').multiselect();
            $('#list-work').multiselect();
            assignInit();
        };
        function assignInit() {
            var o = {
                a: 'fGetgcGobal_COMP_EmployeeLife',
                _f: 'Id, departmentid, departmentidname, HoTen',
                c: {
                    Id: '$x > 78 order by departmentidname, departmentid, HoTen, id '
                }
            };
            var lae = [];
            request(o, {
                success: function (o, opt, r) {
                    $('#list-employee').empty();
                    var t = 0;
                    var $el;
                    for (var i = 0; i < r.Records.length; i++) {
                        lae.push(r.Records[i][0]);
                        if (r.Records[i][1] != t) {
                            $el = $('<optgroup label="' + r.Records[i][2] + '"/>');
                            t = r.Records[i][1];
                            $('#list-employee').append($el);
                        }
                        $el.append('<option value="' + r.Records[i][0] + '">' + r.Records[i][3] + '</option>');
                    }
                    $('#list-employee').multiselect('rebuild');
                },
            });
            $('#work-type').change(function () {
                var obj = {};
                if ($(this).val() == 1)
                    obj = {
                        a: 'fGetgcGobal_TASK_Event',
                        _f: 'Id, WorkTypeId, WorkTypeIdCode, Name',
                        c: {
                            Id: '$x is not null order by worktypeIdCode, worktypeid, Name, id '
                        }
                    };
                else
                    obj = {
                        a: 'fGetgcGobal_TASK_Work_External_Assignment',
                        _f: 'Id, WorkTypeId, WorkTypeIdCode, Name',
                        c: {
                            Id: '$x is not null order by worktypeIdCode, worktypeid, Name, id '
                        }
                    };
                request(obj, {
                    success: function (o, opt, r) {
                        $('#list-work').empty();
                        var t = 0;
                        var $el;
                        for (var i = 0; i < r.Records.length; i++) {
                            if (r.Records[i][1] != t) {
                                $el = $('<optgroup label="' + r.Records[i][2] + '"/>');
                                t = r.Records[i][1];
                                $('#list-work').append($el);
                            }
                            $el.append('<option value="' + r.Records[i][0] + '">' + r.Records[i][3] + '</option>');
                        }
                        $('#list-work').multiselect('rebuild');
                    },
                });
            });
            $('#work-type').trigger('change');
            $('#from-date').datepicker();
            $('#to-date').datepicker();
            $('#assign-work-button').click(function () {
                if (validate()) {
                    var le = $('#list-employee').val() == null ? $('#list-employee').val() : lae;
                    var lw = $('#list-work').val();
                    var fd = dateToString(gDT($('#from-date').val().replace(/\//g, '-'), '00:00'), 'iso');
                    var td = dateToString(gDT($('#to-date').val().replace(/\//g, '-'), '00:00'), 'iso');
                    var mk = $('#mark').val();
                    var smk = $('#sub-mark').val();
                    var amk = $('#add-mark').val();
                    var st = $('#work-status').val();
                    var no = $('#note').val();
                    var ct = $('#work-type').val();
                    var d = [];
                    for (var i = 0; i < le.length; i++) {
                        for (var j = 0; j < lw.length; j++) {
                            if (ct == 1)
                                d.push({
                                    StartDate: fd,
                                    EndDate: td,
                                    Marks: mk,
                                    SubMarks: smk,
                                    TaskStatusId: st,
                                    AddMarks: amk,
                                    EmployeeId: le[i],
                                    WorkEventId: lw[j],
                                    Note: no
                                });
                            else
                                d.push({
                                    StartDate: fd,
                                    EndDate: td,
                                    Marks: mk,
                                    SubMarks: smk,
                                    TaskStatusId: st,
                                    AddMarks: amk,
                                    EmployeeId: le[i],
                                    WorkExternalId: lw[j],
                                    Note: no
                                });
                        }
                    }
                    var obj1 = {
                        a: 'AssignWork',
                        d: d
                    };
                    request(obj1, {
                        success: function (o, opt, r) {
                            if (r.Result == 1) {
                                $('#assign-work-alert').html('<strong>Thông báo! </strong> Bạn vừa mới gán công việc thành công');
                                $('#assign-work-alert').show('slow');
                                var t = setTimeout(function () {
                                    $('#assign-work-alert').hide('slow');
                                    clearTimeout(t);
                                }, 3000);
                            }
                        }
                    });
                } else {
                    $('#assign-work-alert').html('<strong>Thông báo! </strong> Thông tin bạn điền chưa đầy đủ');
                    $('#assign-work-alert').show('slow');
                    var t = setTimeout(function () {
                        $('#assign-work-alert').hide('slow');
                        clearTimeout(t);
                    }, 3000);
                }
            });
        };
        function validate() {
            if ($('#list-work').val() != null && $('#from-date').val() != ''
                && $('#to-date').val() != '')
                return true;
            return false;
        }

        function request(obj, opt) {
            $.ajax({
                url: '/WSASMXGobal/Kernel.asmx/P',
                type: "POST",
                crossDomain: true,
                data: JSON.stringify({ obj: obj }),
                contentType: "application/json; charset=utf-8",
                success: function (r) {
                    if (typeof opt.success == 'function')
                        opt.success(obj, opt, parseJsResponse(r));
                },
            });
        }
        function parseJsResponse(data) {
            if (data.hasOwnProperty('d')) {
                return data.d;
            }
            return data;
        }

        $(document).ready(function () {
            assignWorkHtml = $('#assign-work').html();
            $('#assign-work').remove();
            $("#ThemVuViecBtn").click(function (ev) {
                _gb.pr(o73).ff(true, o73);
                _gb.rf(o73);
                gb_curBoxDlg = $("#ThemVuViecBtn").colorbox({ inline: true, width: "97%", height: "97%", href: "#o73", title: _gb.ll(0, o73) });
            });

            $('#dropdown-database ul li').click(function () {
                if (!$(this).hasClass('active')) {
                    $('#dropdown-database ul li').removeClass('active');
                    $(this).addClass('active');
                    var o = {};
                    var on = '';
                    switch ($(this).find('a').attr('id')) {
                        case 'a2': o = o285; on = '#o285';
                            gb_strFilterGrid = " ";
                            break;
                        case 'a3': o = o286; on = '#o286';
                            gb_strFilterGrid = " ";
                            break;
                        case 'a4': o = o282; on = '#o282';
                            gb_strFilterGrid = " ";
                            break;
                        case 'a5': o = o281; on = '#o281';
                            gb_strFilterGrid = " ";
                            break;
                        case 'a6': o = o280; on = '#o280';
                            gb_strFilterGrid = " ";
                            break;
                        case 'a7': o = o279; on = '#o279';
                            gb_strFilterGrid = " ";
                            break;
                        case 'a8': o = o287; on = '#o287';
                            gb_strFilterGrid = " ";
                            break;
                        case 'a9': o = o278; on = '#o278';
                            gb_strFilterGrid = " ";
                            break;
                        case 'a10': o = o283; on = '#o283';
                            gb_strFilterGrid = " ";
                            break;
                        case 'a11': o = o18; on = '#o18';
                            gb_strFilterGrid = " id > 78 ";
                            break; //Employee
                        case 'a12': o = o17; on = '#o17'; break; //Department
                        case 'a13':
                            gb_strFilterGrid = " ";
                            assignWork($(this), $('.sidebar-content'));
                            return;
                        case 'a14':
                            o = o288; on = '#o288';
                            gb_strFilterGrid = " ";
                            break;
                        default:
                    }
                    _gb.pr(o).ff(true, o);
                    _gb.rf(o);
                    view($(this), $('.sidebar-content'), o, on);
                }
            });
            var t = setTimeout(function () {
                $('#dropdown-database ul li #a8').trigger('click');
                clearTimeout(t);
            }, 500);
            $('#fbc00i').click(function (ev) {
                test('fbc00i', ev, '', 'gcGobal_COMP_EmployeeLife', 'HoTen');
            });
            $('#fbc00i').keyup(function (ev) {
                test('fbc00i', ev, '', 'gcGobal_COMP_EmployeeLife', 'HoTen');
            });
            $('#fbc01i').click(function (ev) {
                test('fbc01i', ev, '', 'gcGobal_COMP_Department', 'Code~Name');
            });
            $('#fbc01i').keyup(function (ev) {
                test('fbc01i', ev, '', 'gcGobal_COMP_Department', 'Code~Name');
            });
            $('#InBillBtn').click(function () {
                var flag = false;
                var rpVal = $('#typeID').val();
                var obj = {};
                switch (rpVal) {
                    case 'rp1':
                        rp1(obj, $('#fbc01h').val());
                        break;
                    case 'rp2':
                        rp2(obj, $('#NgayBatDauIdNew').val().replace(/\//g, '-'), $('#NgayKetThucIdNew').val().replace(/\//g, '-'), $('#fbc00h').val(), $('#fbc01h').val());
                        break;
                    case 'rp3':
                        rp3(obj, $('#NgayBatDauIdNew').val().replace(/\//g, '-'), $('#NgayKetThucIdNew').val().replace(/\//g, '-'), $('#fbc00h').val(), $('#fbc01h').val());
                        break;
                    case 'rp4':
                        rp4(obj, $('#NgayBatDauIdNew').val().replace(/\//g, '-'), $('#NgayKetThucIdNew').val().replace(/\//g, '-'), $('#fbc00h').val(), $('#fbc01h').val());
                        break;
                    case 'rp5':
                        rp5(obj, $('#NgayBatDauIdNew').val().replace(/\//g, '-'), $('#NgayKetThucIdNew').val().replace(/\//g, '-'), $('#fbc00h').val(), $('#fbc01h').val());
                        break;
                    case 'rp6':
                        rp6(obj, $('#NgayBatDauIdNew').val().replace(/\//g, '-'), $('#NgayKetThucIdNew').val().replace(/\//g, '-'), $('#fbc00h').val(), $('#fbc01h').val());
                        break;
                        //case 'rp7':
                        //    rp7($('#InBillBtn'), $('#NgayBatDauIdNew').val(), 100 /*Id nhan vien*/);
                        //    break;
                        //case 'rp8':
                        //    rp8($('#InBillBtn'), $('#NgayBatDauIdNew').val(), 100 /*Id nhan vien*/);
                        //    break;
                        //case 'rp9':
                        //    rp9($('#InBillBtn'), $('#NgayBatDauIdNew').val(), 100 /*Id nhan vien*/);
                        //    break;
                    default:
                        flag = true;
                        break;
                }
                if (!flag) {
                    $.ajax({
                        type: "POST",
                        url: '/zgcReport/Report.ashx',
                        crossDomain: true,
                        data: JSON.stringify({ obj: obj }),
                        success: function (msg) {
                            showError(msg);
                        },
                        error: function () {
                            alert("Error");
                        }
                    });
                } else {
                    alert('Báo cáo loại này hiện tại chưa có');
                }
            });
            $('#reloadCV').click(function () {
                if ($('#dropdown-database ul li #a8').closest('li').hasClass('active')) {
                    $("#o287_g").jtable('load', {
                        obj: { a: 'pGet' + o287._e[0], c: '', d: '', type: 'p', cl: '*', si: 1, mr: 50, se: ' Id desc', f: $('#fbc01h').val() == '' ? '' : (' DepartmentId = ' + $('#fbc01h').val()) }
                       , jtStartIndex: 0
                       , jtPageSize: 300
                    });
                }
                if ($('#dropdown-database ul li #a9').closest('li').hasClass('active')) {
                    $("#o278_g").jtable('load', {
                        obj: { a: 'pGet' + o278._e[0], c: '', d: '', type: 'p', cl: '*', si: 1, mr: 50, se: ' taskStatusid desc ', f: ($('#fbc00h').val() == '' ? ($('#fbc01h').val() == '' ? '' : ' employeeid in (select id from gcgobal_comp_employeelife where departmentid = ' + $('#fbc01h').val() + ') ') : (' EmployeeId = ' + $('#fbc00h').val())) }
                       , jtStartIndex: 0
                       , jtPageSize: 300
                    });
                }
            });

        });

        $(window).load(function () {
            cur_gb_Account = '<%= Session["gcUserName"] %>'; // có thời gian mã hóa tên của user để che lại
            cur_gb_GroupRight = '<%= Session["gcRightGroup"] %>';
            cur_gb_Branch = '<%= Session["branchId"] %>';

            //viết thành hàm configRight gọi mỗi khi cần set
            //gc_fn_Gobal_ConfigRightLoadForm();
            $("#gc_gobal_PagerTopID").hide();

            //click vao cái đầu tiên
            $("#profileTab").click();
            $('.selectpicker').selectpicker({
                'selectedText': 'cat'
            });
            setClassAll('FilterReceiptDay');
            $("#NgayBatDauIdNew").val(XDate.today().toString("dd/MM/yyyy"));
            $("#NgayKetThucIdNew").val(XDate.today().toString("dd/MM/yyyy"));
            //obj.t1 = gcDateC($("#NgayBatDauIdNew").val());
            //obj.t2 = gcDateC($("#NgayKetThucIdNew").val());
            // $('.selectpicker').selectpicker('hide');
        });



    </script>


</head>

<body>
    <a id='URLDownloadFile' style='display: none;' href=''></a>
    <form action="ClassInfo.aspx?paramExportFile=ExportToWord" method="post" id="downloaddata" style="display: none; visibility: hidden">
        <input type="submit" value="download" style="display: none; visibility: hidden" />
    </form>

    <form id="loginForm" runat="server">

        <!-- Webservice Information -->
        <asp:ScriptManager ID='gcSM' runat='server' EnablePageMethods='true' ScriptMode='Release'>
            <Services>

                <asp:ServiceReference Path="~/WSASMXGobal/Kernel.asmx" />

            </Services>
        </asp:ScriptManager>
        <!-- End webservice Information -->


        <div id="container">
            <div class="container">

                <!-- gc Header form : first time is enable-->
                <gc_MainMenu:MainMenu ID='gc_parent_MenuID' runat="server" />
                <div style="clear: both;"></div>
                <!-- End gc Header form -->

                <!-- This contains the hidden content for inline calls -->

                <div style='display: none'></div>

                <div id="FilterReceiptDay" class="content" style="padding: 0 10px 10px 10px">
                    <div class="gc_SearchForm" id="Div2">
                        <div id="Div3" class="login_sign">
                            <div class="input">
                                <label>Từ Ngày</label>
                                <input type="text" name="datepicker" id="NgayBatDauIdNew" autocomplete="off" style="background: url(&quot;../Usercontrol/images/date7.png&quot;) no-repeat scroll right 5px center rgb(255, 255, 255); padding-right: 20px; color: rgb(136, 136, 136);" class="form-control valid">
                                <label>Tới ngày</label>
                                <input type="text" name="datepicker" id="NgayKetThucIdNew" autocomplete="off" style="background: url(&quot;../Usercontrol/images/date7.png&quot;) no-repeat scroll right 5px center rgb(255, 255, 255); padding-right: 20px; color: rgb(136, 136, 136);" class="form-control">

                                <label>Nhân viên :</label>
                                <input type="text" class="brwidthinput300 input-large form-control gc-style-form-combo" name="combo" id="fbc00i" value="Chọn danh sách..." autocomplete="off">
                                <input type="text" style="display: none;" id="fbc00h" class="form-control">
                            </div>

                            <div class="input">
                                <label>Chọn phòng ban:</label>
                                <input type="text" class="brwidthinput300 input-large form-control gc-style-form-combo" name="combo" id="fbc01i" value="Chọn danh sách..." autocomplete="off">
                                <input type="text" style="display: none;" id="fbc01h" class="form-control">
                            </div>
                        </div>
                        <div class="clear"></div>


                        <div class="col-lg-4">
                            <select name="master" data-live-search="true" class="selectpicker show-tick form-control" id="typeID" style="display: none;">
                                <option value="rp1" id="Option1">1. Danh sách công việc phòng ban</option>
                                <option value="rp2" id="Option2">1. Báo cáo chi tiết nhân viên theo ngày</option>
                                <option value="rp3" id="Option3">2. Báo cáo chi tiết phòng ban theo ngày</option>
                                <option value="rp4" id="Option4">3. Báo cáo tính điểm nhân viên theo ngày</option>
                                <option value="rp5" id="Option5">4. Báo cáo tổng hợp nhân viên theo tháng</option>
                                <option value="rp6" id="Option6">5. Báo cáo tổng hợp phòng ban</option>
                            </select>
                        </div>

                        <input type="button" class="btn btn-primary btn-sm" id="InBillBtn" value="In Báo Cáo">

                        <input type="button" class="btn btn-primary btn-sm" id="reloadCV" value="Load Công việc">
                    </div>
                </div>


                <div style="clear: both;"></div>
                <!-- End gc Header form -->

                <!-- gc Search Filter : first time is enable-->

                <!-- End gc Search Filter -->



                <!-- gc Information : for notify successfull update, insert, error, first time is disable-->
                <div class="content" id="gc_gobal_InformationID">
                </div>
                <!-- End gc Information -->


                <!-- End gc Main Form -->
                <div class="content" id="gc_gobal_MainFormID">
                    <div class="alert alert-info alert-info-gc-small" id="gc_gb_MessageInfomation"><strong>Chú ý!</strong> Bạn phải gõ khoảng trắng vào ô text để search.</div>

                    <!--/tabs-->
                    <div id="content">
                        <div class="sidebar-content" style="float: left;">
                        </div>
                    </div>

                    <div style="clear: both;"></div>


                </div>
                <!---content-->
                <!-- End gc Main Form -->
                <div style="clear: both;"></div>

                <div id="report" style="display: none"></div>
                <div id="assign-work">
                    <div id="assign-work-alert" class="alert alert-info alert-info-gc-small" style="display: none">
                    </div>
                    <div class="row">
                        <div class="col-md-5">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-4 control-label">Phân loại: </label>
                                <div class='select-group col-sm-8'>
                                    <select id="work-type" class="form-control">
                                        <option value="1" selected="selected">Event</option>
                                        <option value="2">Ngoại lệ</option>
                                    </select>
                                </div>
                            </div>
                        </div>

                    </div>
                    <div class="row">
                        <div class="col-md-5">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-4 control-label">Công việc: </label>
                                <div class='select-group col-sm-8'>
                                    <select id="list-work" multiple="multiple" class="form-control">
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-md-5">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-4 control-label">Nhân viên: </label>
                                <div class='select-group col-sm-8'>
                                    <select id="list-employee" multiple="multiple" class="form-control">
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-5">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-4 control-label">Từ ngày: </label>
                                <div class='input-group col-sm-8'>
                                    <input type="text" id="from-date" class="form-control" />
                                </div>
                            </div>
                        </div>
                        <div class="col-md-5">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-4 control-label">Đến ngày: </label>
                                <div class='input-group col-sm-8'>
                                    <input type="text" id="to-date" class="form-control" />
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-5">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-4 control-label">Điểm: </label>
                                <div class='input-group col-sm-8'>
                                    <input type="text" id="mark" class="form-control" />
                                </div>
                            </div>
                        </div>
                        <div class="col-md-5">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-4 control-label">Điểm cộng: </label>
                                <div class='input-group col-sm-8'>
                                    <input type="text" id="add-mark" class="form-control" />
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-5">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-4 control-label">Điểm trừ: </label>
                                <div class='input-group col-sm-8'>
                                    <input type="text" id="sub-mark" class="form-control" />
                                </div>
                            </div>
                        </div>
                        <div class="col-md-5">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-4 control-label">Trạng thái: </label>
                                <div class='select-group col-sm-8'>
                                    <select id="work-status" class="form-control">
                                        <option value="2" selected="selected">Chưa hoàn thành</option>
                                        <option value="1">Hoàn thành</option>
                                    </select>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-md-5">
                            <div class="form-group">
                                <label for="inputEmail3" class="col-sm-4 control-label">Ghi chú: </label>
                                <div class='textarea-group col-sm-8'>
                                    <textarea id="note" class="form-control"></textarea>
                                </div>
                            </div>
                        </div>

                    </div>
                    <div class="inputBtnBottomV2">
                        <input type="button" id="assign-work-button" value="Gán việc" class="btn btn-primary btn-sm">
                    </div>
                </div>
            </div>
            <!--/.container-->
        </div>
        <!--/ #container-->

    </form>

    <!-- Footer Information -->
    <gc_footer:Footer ID='gc_footer_ID' runat="server" />
    <!-- End footer Information -->

    <!-- Le javascript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script type="text/javascript" src="../jsGobalLib/widgets.js"></script>
    <!-- The Load Image plugin is included for the preview images and image resizing functionality -->
    <script type="text/javascript" src="../jsGobalLib/load-image.min.js"></script>
    <!-- The Canvas to Blob plugin is included for image resizing functionality -->
    <script type="text/javascript" src="../jsGobalLib/canvas-to-blob.min.js"></script>
    <!--
     <script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
    <script type="text/javascript" src="http://blueimp.github.io/JavaScript-Load-Image/js/load-image.min.js"></script>
    <script type="text/javascript" src="http://blueimp.github.io/JavaScript-Canvas-to-Blob/js/canvas-to-blob.min.js"></script> 
    -->

    <script type="text/javascript" src="../UserControl/bootstrap/assets/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../UserControl/bootstrap/assets/js/holder.js"></script>


</body>
</html>

